package com.shujunjun.project.springes.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author wsh
 * @since 2024/8/27 23:31
 */
@Data
@Document(indexName = "task-execute")
public class TaskExecute implements Serializable {

    /**
     * 任务id
     */
    @Id
    @Field(name = "taskId", type = FieldType.Integer)
    private Integer taskId;

    /**
     * 容器号
     */
    @Field(name = "containerNo")
    private String containerNo;

    /**
     * 原因
     */
    @Field(name = "reason", type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    private String reason;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @Field(name = "createdTime", type = FieldType.Date, pattern = "yyyy-MM-dd'T'HH:mm:ss",
            format = DateFormat.date_hour_minute_second)
    private LocalDateTime createdTime;
}
